<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<script type="text/javascript">
    var ctx = '${ctx}';

    //弹出右
    $("#addClinic").on('click',function(){
        hideShowTableTd('contentTable','5,6，7,8,9','2');
        $("#LeftDiv").attr("class","main-content col-lg-8");
        $("#RightDiv").show('normal');
        var patientId=$("#patientId").val();
        var clinicId=$("#clinicId").val();
        return loadDiv('rigthCenterDiv','${ctx}/doctor/outpTreatRec/formMaterial?patientId='+patientId+"&clinicId="+clinicId);
    })
  $(function(){
      $("#contentTable").treeTable();

  })
    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#contentTable").submit();
        return false;
    }
</script>
<div class="app">
    <section class="layout">
        <section class="main-content col-lg-12" id="LeftDiv">
            <div class="content-wrap">
                <div class="wrapper">
                     <section class="panel panel-default">
                        <div class="panel-body">
                            <div class="form-group">
                                 <input  class="btn btn-primary" type="button" value="新增" id="addClinic"/>
                            </div>
                            <div class="table-responsive no-border">

                                 <table id="contentTable" class="table table-bordered table-striped mg-t datatable">
                                    <thead>
                                    <tr>
                                        <th>项目名称</th>
                                        <th>数量</th>
                                        <th>厂商</th>
                                        <th>单位</th>
                                        <th>规格</th>
                                        <th>执行科室</th>
                                        <th>实收</th>
                                        <th>收费标识</th>
                                        <th>开单时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach items="${page.list}" var="treat" varStatus="ot">
                                        <tr id="${treat.id}">
                                            <td> ${treat.itemName}</td>
                                            <td> ${treat.num}</td>
                                            <td> ${treat.supplierName}</td>
                                            <td> ${treat.unitsStr}</td>
                                            <td> ${treat.packageSpec}</td>
                                            <td> ${treat.implementDeptEt.deptName}</td>
                                            <td> ${treat.sumPrice}</td>
                                            <td> ${fns:getDictLabels(treat.chargeFlag,'NO_CHARGE','')}</td>
                                            <td> <fmt:formatDate value="${treat.createDate}" pattern="yyyy-MM-dd  HH:mm:ss" /></td>
                                            <td>
                                                <c:choose>
                                                    <c:when test="${treat.chargeFlag==1  && treat.isApply == 0}">
                                                        <a href="#" onclick="confirmExtend('确定要退费吗？',function(){delLoad('rigthDoctorCenterDiv','${ctx}/finance/refundChargesApply/save?ordersId=${treat.ordersId}&applyType=5&confirmFlag=${treat.confirmFlag}','${ctx}/doctor/outpTreatRec/material?clinicId=${treat.clinicId}&patientId=${treat.patientId}&inoroutFlag=0')})" class="btn btn-warning btn-xs">退费</a>
                                                    </c:when>
                                                    <c:when test="${treat.chargeFlag==5 && treat.isApply == 0}">
                                                            申请退费待确认中
                                                    </c:when>
                                                    <c:when test="${treat.chargeFlag==4 && treat.confirmFlag != 1 && treat.isApply == 0}">
                                                        申请退费中
                                                    </c:when>
                                                    <c:when test="${treat.isApply == 1}">
                                                        来自申请单
                                                    </c:when>
                                                    <c:when test="${treat.chargeFlag==0 && treat.isApply==0}">
                                                        <a href="#"  class="applyBt btn btn-danger btn-xs" onclick="confirmExtend('确认要删除该治疗信息吗？',function(){delLoad('rigthDoctorCenterDiv','${ctx}/doctor/outpTreatRec/delete?ordersId=${treat.ordersId}','${ctx}/doctor/outpTreatRec/material?clinicId=${treat.clinicId}&patientId=${treat.patientId}&inoroutFlag=0')})">删除</a>
                                                    </c:when>
                                                    <c:otherwise>
                                                        无
                                                    </c:otherwise>
                                                </c:choose>

                                            </td>
                                        </tr>
                                        <c:if test="${treat.outpTreatPresc.size()>0}">
                                            <tr id="${ot.count}" pid="${treat.id}">
                                                <td colspan="5">
                                                    <table class="table table-bordered mg-t">
                                                        <tr>
                                                            <th>名称</th>
                                                            <th>结果</th>
                                                        </tr>
                                                        <c:forEach items="${treat.outpTreatPresc}" var="outpTP" varStatus="outp">
                                                            <tr>
                                                                <td>${outpTP.drugName}</td>
                                                                <td>${fns:getDictLabels(outpTP.skinResult,'SKIN_TEST_RESULT','')}</td>
                                                            </tr>
                                                        </c:forEach>
                                                    </table>
                                                </td>

                                            </tr>
                                        </c:if>
                                    </c:forEach>
                                    </tbody>
                                </table>
                               <div class="pagination">${page}</div>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </section>

        <%--右侧诊疗项目列表--%>
        <section class="main-content col-lg-4" style="display: none" id="RightDiv">
            <div class="content-wrap" id="rigthCenterDiv">
            </div>
        </section>
        <input type="hidden" id="patientId" value="${outpTreatRec.patientId}">
        <input type="hidden" id="clinicId" value="${outpTreatRec.clinicId}">
    </section>

</div>
